<?php
namespace app\admin\controller;
class Contact extends Init
{
    public function index()
    {
        $contact = db('contact')->select();
        $this->assign("contact", $contact);
        return view();
    }

    public function del()
    {
        $id = input('id');
        if(db('contact')->where('c_id',$id)->delete()){
            return $this->success('删除成功！','contact/index');
        }else{
            return $this->error('删除失败！');
        }
    }

    public function delall(){
        $data = input('post.');

        $arrdel = $data['idarr'];
        if(request()->isPost()) {
            foreach ($arrdel as $id){
                db('contact')->where('c_id',$id)->delete();
            }
            $this->success('删除成功！','contact/index');
        }
    }
}